import { request, hotelRequest, otherRequest } from '@/sheep/request';

export default {
// 店铺列表
	shopList: (data = {}) =>
		request({
			url: '/store/api/takeout/store',
			method: 'GET',
			data,
			custom: {
				showLoading: false,
				showError: false,
			},
		}),
	// 店铺详情
		shopDetail: (id, params = {}) =>
			request({
				url: '/store/api/takeout/store/' + id,
				method: 'GET',
				params,
				custom: {
					showLoading: false,
					showError: false,
				},
			}),
	// 店内搜索
		goodSearch: (params = {}) =>
			request({
				url: '/store/api/takeout/store/select',
				method: 'GET',
				params,
				custom: {
					showLoading: false,
					showError: false,
				},
			}),
	// 购物车列表
		cartList: (params = {}) =>
			request({
				url: '/store/api/takeout/cart',
				method: 'GET',
				params,
				custom: {
					showLoading: false,
					showError: false,
				},
			}),
		// 修改购物车
			cartEdit: (data) =>
				request({
					url: '/store/api/takeout/cart/change',
					method: 'POST',
					data,
					custom: {
						showLoading: false,
						showError: false,
					},
				}),

  createOrderList: (data) =>
    request({
      url: '/store/api/takeout/order',
      method: 'GET',
      data,
      custom: {
        showLoading: true,
        showError: true,
      },
    }),
  createOrderDetail: (id) =>
    request({
      url: `/store/api/takeout/order/${id}`,
      method: 'GET',
      custom: {
        showLoading: true,
        showError: true,
      },
    }),

  // 支付页外卖订单详情
  orderDetail: (id) =>
    request({
      url: 'order/order/' + id,
      method: 'GET',
    }),
  // 支付页外卖订单支付
  prepay: (data) =>
    request({
      url: '/shop/api/pay/prepay',
      method: 'POST',
      data,
    }),

  // 清空购物车
  cartClear: (data) =>
    request({
      url: '/store/api/takeout/cart/clearCart',
      method: 'POST',
      data,
      custom: {
        showLoading: false,
        showError: false,
      },
    }),
  // 外卖下单
  createOrder: (data) =>
    request({
      url: '/store/api/takeout/order/create',
      method: 'POST',
      data,
      custom: {
        showLoading: false,
        showError: false,
      },
    }),
};
